/*
 * Copyright © 2004-2014 chenYuan. All rights reserved.
 * @Website:wwww.jspx.net
 * @Mail:39793751@qq.com
 * @author: chenYuan , 陈原
 * @License: Jspx.net Framework Code is open source (LGPL)，Jspx.net Framework 使用LGPL 开源授权协议发布。
 * @jvm:jdk1.6+  x86/amd64
 *
 */
package com.jspx.txweb.view;


import com.jspx.txweb.annotation.HttpMethod;
import com.jspx.txweb.support.ActionSupport;
import com.jspx.txweb.table.PaymentFirm;
import com.jspx.utils.StringUtil;
import jspx.user.payment.env.PaymentEnv;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: chenYuan
 * Date: 11-4-19
 * Time: 上午11:12
 */
@HttpMethod(caption = "支付方式")
public class PaymentView extends ActionSupport {
    final public static List<PaymentFirm> list = new ArrayList<PaymentFirm>();

    static {
        PaymentFirm pf = new PaymentFirm();
        pf.setId(PaymentEnv.ADVANCE_PAYMENT);
        pf.setCaption("预付款");
        list.add(pf);

        pf = new PaymentFirm();
        pf.setId(PaymentEnv.CASH_ON_DELIVERY);
        pf.setCaption("货到付款");
        list.add(pf);

    }

    public List<PaymentFirm> getList() {
        return list;
    }

    public int getTotalCount() throws Exception {
        return list.size();
    }

    public String getOptions()
    {
        StringBuilder sb = new StringBuilder();
        for (PaymentFirm pf:list)
        {
           sb.append(pf.getId()).append(":").append(pf.getCaption()).append(StringUtil.SEMICOLON);
        }
        return sb.toString();
    }
}